package com.module.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
public class LoginController {

    @Autowired
    private StringRedisTemplate redisTemplate;
    @RequestMapping("/login")
    public String login(String username, String pwd, HttpSession session){
        redisTemplate.opsForValue().set("login_user",username+pwd);
        session.setAttribute("springsession_user",username+pwd);
        return "ok";
    }
}
